package com.gujiayue.module.sys.dao;

import java.util.List;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.cursor.Cursor;

import com.gujiayue.module.sys.dao.sql.SysUsrSqlBuilder;
import com.gujiayue.module.sys.pojo.SysUsrDo;

@Mapper
public interface SysUsrDao {

	@SelectProvider(type = SysUsrSqlBuilder.class, method = "countPersonSql")
	int pageCount(SysUsrDo sysUsrDo);
	
	@SelectProvider(type = SysUsrSqlBuilder.class, method = "selectPersonSql")
	List<SysUsrDo> findList(SysUsrDo sysUsrDo);
	
	@DeleteProvider(type = SysUsrSqlBuilder.class, method = "deletePersonSql")
	int delete(SysUsrDo sysUsrDo);
	
	@InsertProvider(type = SysUsrSqlBuilder.class, method = "insertPersonSql")
	@Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
	int insert(SysUsrDo sysUsrDo);
	
	@UpdateProvider(type = SysUsrSqlBuilder.class, method = "updatePersonSql")
	int update(SysUsrDo sysUsrDo);
	
	@Select("select * from sys_usr limit #{limit}")
    Cursor<SysUsrDo> cursorPage(@Param("limit") String limit);
	
	
	SysUsrDo loadUserByUsername(SysUsrDo sysUsrDo);
}
